package controller.listeners.batchPosCodeCorps;

import model.BatchPosCodeCorpsModel;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import dao.Center;

import business.ViewLogger;
import business.coding.CenterWeightAndWords;

import view.BatchPosCodeCorpsView;
import view.ViewUtils;

public class FilterKeyDownListener implements Listener {


	private BatchPosCodeCorpsView _view;
	private BatchPosCodeCorpsModel _model;
	
			public FilterKeyDownListener(BatchPosCodeCorpsView view,
					BatchPosCodeCorpsModel model) {
				this._model = model;
				this._view = view;
			}
			
			 public void handleEvent(Event event) {
				 if (event.character == '\r') {
					 	//Limpio centros, corps, etc
					 	 _model.reset();
					 	 
					 	 _model.setCorpFilter(_view.getCorpFilter());
					 	 
					 	 _model.set_custom_corp("");
					 	 
					 	 _view.setCachePreCodeCorps(_model.get_cache_precodecorps());
					 	 _view.setCandidateCenters(_model.getCandidateCenters());
					 	 
		           
		        }

			 }
}